package io.renren.modules.article.controller;

import io.renren.common.utils.R;
import io.renren.modules.article.entity.LabelEntity;
import io.renren.modules.article.openfeign.ArticleOpenFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author 李涛
 * @date 2020-09-03 15:59
 */
@RestController
@RequestMapping("/label")
public class LabelController {
    @Autowired
    private ArticleOpenFeignService articleOpenFeignService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String,Object> parms){
        return articleOpenFeignService.listLable(parms);
    }
    @RequestMapping("/save")
    public R save(@RequestBody LabelEntity entity){
        return articleOpenFeignService.saveLabel(entity);
    }
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        return articleOpenFeignService.deleteLabel(ids);
    }

    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        return articleOpenFeignService.infoLabel(id);
    }

    /**
     * 更新标签
     *
     * @param entity 标签实体类
     * @return
     */
    @RequestMapping("/update")
    public R update(@RequestBody LabelEntity entity){
        return articleOpenFeignService.updateLabel(entity);
    }
}
